package com.shujia.trip.utils;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class FileReaderUtil {
    public static String readFile(String path) {
        StringBuilder sqlStr = new StringBuilder();

        FileReader fileReader = null;
        try {
            fileReader = new FileReader(path);
            BufferedReader br = new BufferedReader(fileReader);

            String line;
            while ((line = br.readLine()) != null) {
                sqlStr.append(line+"\n");
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


        return sqlStr.toString();

    }

    public static void main(String[] args) {
        String s = FileReaderUtil.readFile("trip/ods/cdc/ods_kafka_activity.sql");
        System.out.println(s);
    }
}
